package struct.decorator.original;

public class Execute {

    public static void main(String[] args) {
        ConcreteComponent c = new ConcreteComponent();
        ConcreteDecoratorA d1 = new ConcreteDecoratorA();
        ConcreteDecoratorB d2 = new ConcreteDecoratorB();

        // 首先用d1来包装c，因为首先会执行初始化的对象的operation方法，所以d1
        d1.setComponent(c);
//        再用d2来包装d1
        d2.setComponent(d1);
//        最终执行d2的operation
        d2.operation();
    }
}
